#!/bin/bash
set -e
set -x
MYDIR="${0%/*}"
cd "$MYDIR/.."
source "recipes/common.sh"


# RECIPE START grub
# depends: cross-pkg-config
# depends: xz

reset_mtime grub grub/configure.ac
rm -rf build/grub
mkdir -p build/grub
cd build/grub
cat > config.cache <<-EOF
ac_cv_path_PYTHON=''
ac_cv_path_XGETTEXT=''
ac_cv_path_GMSGFMT=''
ac_cv_path_MAKEINFO=/bin/true
ac_cv_pathless_PYTHON=''
am_cv_pathless_PYTHON=''
EOF

../../grub/configure \
	${CONFIGURE_ARGS} \
	--cache-file=config.cache \
	--target="${TARGET}" \
	--with-platform=efi \
	--with-utils=host \
	--disable-werror \
	${AUTOCRAP_KLUDGE}

cd ../..
make_build build/grub
mkdir -p "$stage/boot/grub"
cp -a -l --target-directory="$stage/boot/grub" \
	"${stage}${prefix}/${target_libdir}/grub/${GRUB_ARCH}-efi"

# RECIPE END grub
